<form action="<?php echo BASE_URL;?>/test/reviewtest" method="post" id="test-form">

<input type="hidden" name="testID" id="testID" value="<?php echo $this->data["testID"];?>">

<?php		
	if(!empty($this->data["testID"])){
			$list_questionID 	= $this->data['question_id'];// danh sách id của câu hỏi
			$list_score    		= $this->data['question_score'];// điểm làm bài của user
			$questionPerPage	= $this->data["question_perpage"];
			$answer_of_user 	= isset($this->data['question'])?$this->data['question']:array(); // các câu trả lời của user
			$list_score_in_test_table	= $this->data["list_score_in_test_table"];// Điểm của câu hỏi được set trong bài test
			$questionPerPage 	= $questionPerPage==0? 1:$questionPerPage;
			$totalQuestion		= count($list_questionID);
			$totalPage			= (int)($totalQuestion/$questionPerPage);
			$totalPage			= $totalQuestion%$questionPerPage==0?$totalPage:($totalPage+1) ;
			$link = "<div class='page_review_test'><font style='font-size: 16px; font-weight: bold; '>Trang: </font> ";
			for($i=0;$i<$totalPage;$i++)
				$link .= "&nbsp;<a href='#' onclick='showPage($i,$questionPerPage); return false;'><span class='focus-page-test-1'> ".($i+1)."</span></a> &nbsp;&nbsp;";
			$link .="</div>";
			echo $link;
			if(!empty($list_questionID[0])){		
					foreach($list_questionID as $key=>$list_questionIDItem){ 
                                                $answer_of_user_temp = isset($answer_of_user[$list_questionIDItem])?$answer_of_user[$list_questionIDItem]:"";
                                                $list_score_temp = isset($list_score[$key])?$list_score[$key]:1;
							// Begin Lấy đường dẫn tuyệt đối cho hình ảnh
							$HTML = $this->viewQuestion($this->data["testID"],
                                                                trim($list_questionIDItem),"Câu ".($key+1)." : ",
                                                                $answer_of_user_temp,
                                                                $this->review_test,
                                                                $this->view_corect,
                                                                $this->view_feedback,
                                                                $this->view_send_result,
                                                                $list_score_temp, 
                                                                $list_score_in_test_table[$key]);
							$HTML = Zend_View_Helper_FormatDate::_tinyMce_get_absolute_path_image("../../../media/images/tinymce","http://".$_SERVER['SERVER_NAME'].BASE_URL."/media/images/tinymce" ,$HTML);
							// End lấy đường dẫn tuyệt đối cho hình ảnh
							echo  $HTML;
						
							echo "<span class='separator-question-test'><hr/></span>";
					}
			
			$link = "<div class='page_review_test'><font style='font-size: 16px; font-weight: bold; '>Trang: </font> ";
			for($i=0;$i<$totalPage;$i++)
				$link .= "&nbsp;<a href='#' onclick='showPage($i,$questionPerPage); return false;'><span class='focus-page-test-2'> ".($i+1)."</span></a> &nbsp;&nbsp;";			
				$link .="</div>";
			echo $link;
			}
?>			
<p align="center">
			<input type="hidden" class="question_per_page" value="<?php echo $questionPerPage; ?>">
			
			<a  class="all-bt-do-test" href="#" onclick="endTestFormConfirm(); return false;">Gửi kết quả bài thi</a>&nbsp;&nbsp;&nbsp;&nbsp;
</p>
<?php  		 
	
	}else{ 
			echo "<p>Hãy chọn lưu đề thi ở bên dưới trước khi xem trước. </p>";
 	} ?>

</form>
<hr/>

<script type="text/javascript" language="javascript">
<!--
$(document).ready(function(){
	$(".question-container-div").hide()
	$(".separator-question-test").hide()
	var question_per_page = $(".question_per_page").val();
	showPage(0,question_per_page);
	$(".focus-page-test").eq(0).addClass("focus-page-test-active");
});
function focusPage(up_or_down,currentPage){
	page_obj  = $(".focus-page-test-"+up_or_down);
	page_obj.removeClass("focus-page-test-active");
	page_obj.eq(currentPage).addClass("focus-page-test-active");
}
function showPage(currentPage, questionPerpage)
{
	focusPage(1,currentPage);
	focusPage(2,currentPage);
	$(".question-container-div").hide()
	$(".separator-question-test").hide()
	var start  	= currentPage*questionPerpage;
	var end		= start+questionPerpage;
	for(i=start; i< end; i++){
		$(".separator-question-test").eq(i).show();
		$(".question-container-div").eq(i).show();
	}
}
function endTestFormConfirm() {
	if(confirm("Bạn chắc chắn muốn nộp bài?")==true)
		$("#test-form").submit();
}


//-->
</script>
